Proposal by Reinout Stevens for Generate UML diagrams from Smalltalk code for Pharo

Proposed by Reinout Stevens (profile, biography) Don't forget to submit this proposal to official Google Melange site too!


How will I do that project

I start by looking at existing, similar tools in other programming languages/environments to get a better grasp of the possibilities. I then look at existing tools to draw diagrams or UML (for example GraphViz or Mondrian) and try to find a common abstraction for these tools. This abstraction would be the building ground for the facilities to generate diagrams.

The result is a reusable library to draw UML diagrams, with a cleanly designed front-end. This front-end is then used to draw our diagrams. The back-end of the library, responsible for generating the diagrams, will be interchangeable. This is needed to allow us to let the project grow over time. We might need more capabilities that a certain tool does not provide.

Once we have these facilities we can convert existing classes to diagrams. This will be done using reflection, so we can get the class relationships, methods etc. Having quite some experience with reflection and metaprogramming, in Pharo and other languages, the convertion should go quite fast. I think that being able to specify the level of granularity is an important requirement. Normally when you generate a diagram you do not want to see the methods of ProtoObject.

At the same time we merge the diagrams into the Pharo IDE. This means looking at the GUI-possibilities of Pharo. There is enough example-code from the editor itself I can learn from. The design should be intuitive: the diagrams should help the coder, not be in his way. We need to look at sane defaults so people can just convert their code to diagrams without going through a wizard. On the other hand people still need to be able to specify the wanted detail of the diagrams.

For more demanding users we need to be able to generate code that draws a certain diagram. This is needed to visualize ideas, which are better expressed by pictures then by words. The generated code needs to be easily understandable so people can quickly make the wanted changes. People need to be able to save or integrate that code in the rest of their project as well, as it could be used for some other purposes. One example I think of is generating a documentation-website.

What methodologies will I use

The whole project has several layers that depend on eachother. It is important to catch flaws in a layer as soon as possible. Flaws only become visible when building the layer that depends on that layer. I suggest we do an interative process, making a simple first version that is used as basis for the second phase. In the second phase we extend and improve the functionality of the first phase.

Suggested timeline and milestones

In the first ten days I look at existing libraries and similar tools in other languages/environments to get a better grasp of the possibilities.

Then I would make the main library to draw diagrams, based on the research I have done. This will take two weeks.

We then integrate this library into Pharo and convert code to diagrams. This will be finished before the first deadline.

We now start with the second phase. First we improve the main library: this means removing flaws discovered in the first phase and adding missing functionality for the final product. This will take one week.

Then we improve the integration in Pharo and the codeconversion. This is done two and a half weeks before the final deadline.

Finally we create a simple webinterface where people can submit code and generate diagrams. We also and add any missing documentation.

An overview of the planning is available here:

http://narwhal.rave.org/~resteven/planner.html

Where I see the risks

One of the problem will be integrating existing libraries to draw diagrams into pharo, as doing system calls is not the proper way to do it. Or I have to use pharo drawing tools but then I'd spend a lot more time on that part.

Another challenge is sandboxing the website to prevent execution of unwanted code. As I will have to execute the user's code to draw the diagram this needs to be done in a safe way. I dont have any experience with SeaSide (the only webframework I have worked with is Ruby on Rails) so learning this framework might take some time as well.

Note that there are several people at my university actively working on Pharo where I always can go to in case I get stuck.

How the results will look like

The code will be in the spirit of Pharo: clean and clearly written, using OOP paradigms. The result will consist out of a seperate library to draw generic UML diagrams. This library is then used to draw class hierarchies in Pharo itself using the GUI. This interface is simple to use and nicely integrated in Pharo to help the coder.




Updated: 9.4.2010